package com.zm.demo.core.nio;

import java.net.InetSocketAddress;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Set;

import static java.lang.System.out;

/**
 * @author zoum
 * @create 2019/9/16 18:16
 */
public class Selector1T {

    public static void main(String[]args) throws Exception{
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.configureBlocking(false);
//        socketChannel.bind(new InetSocketAddress(9987));
        socketChannel.connect(new InetSocketAddress(9988));

        Selector selector = Selector.open();
        socketChannel.register(selector, SelectionKey.OP_CONNECT);
    }
}
